Restartable, lock-free concurrent shared memory state with pointers

ABSTRACT

Systems and methods for processing memory address spaces corresponding to a shared memory are disclosed. After a writer restart process, pre-restart writer pointers of a pre-restart writer addressable space in the shared memory are replaced with corresponding location independent pointers. A writer pointer translation table is rebuilt in the shared memory to replace an association of modified pre-restart writer pointers and pre-restart translation base pointers based on the pre-restart writer pointers, respectively, with an association of modified post-restart writer pointers and post-restart translation base pointers based on post-restart writer pointers, respectively. After the writer pointer translation table is rebuilt, the location independent pointers are replaced with post-restart writer pointers in the shared memory, respectively, and the post-restart writer pointers are stored in the shared memory for access by one or more readers of the shared memory.

BACKGROUND

The present disclosure relates to address processing of a shared memoryby a writer and a reader of the shared memory in response to a writerrestart operation.

BRIEF DESCRIPTION OF THE DRAWINGS

Various objects and advantages of the disclosure will be apparent uponconsideration of the following detailed description, taken inconjunction with the accompanying drawings, in which like referencecharacters refer to like parts throughout, and in which:

FIG. 1 shows an illustrative diagram of a memory management system 100,in accordance with some embodiments of the disclosure;

FIG. 2 shows an illustrative diagram of a memory management system 200,in accordance with some embodiments of the disclosure;

FIG. 3 shows an illustrative diagram of a memory management system 300,in accordance with some embodiments of the disclosure;

FIG. 4 shows an illustrative diagram of an example entry field structure400, in accordance with some embodiments of the disclosure;

FIG. 5 shows a flowchart of an illustrative process for performing awriter memory address process, in accordance with some embodiments ofthe disclosure;

FIG. 6 shows a flowchart of an illustrative process for performing areader memory address process, in accordance with some embodiments ofthe disclosure; and

FIG. 7 shows a diagram of an illustrative network device of each of thesystems of FIGS. 1, 2, and 3, in accordance with some embodiments of thedisclosure.

DETAILED DESCRIPTION

Shared memory-based systems benefit from certain inherentcharacteristics not typically realized by their counterpart memoryintegrated-based systems. An aspect of shared memories setting theirsystems role apart from integrated memory-based systems, for example, instate sharing system applications, is their physical isolation fromtheir respective clients, e.g., agents, processes, and mechanismsinterfacing with the shared memory. Their physical isolation helpsshared memories carry on despite potential client upsets. Morespecifically, the contents of shared memories persist even in the faceof shared memory client crashes, power restarts, power failures, andother types of client mishaps or interruptions. Client isolation is ashared memory constitution by virtue of the separate and independentshared memory addressable spaces relative to respective content producerclients (“writers” or “writer agents”) and content consumer clients(“readers” or “reader agents”).

In some cases, a writer constituent writes to shared memory locationswith raw pointers of a distinct writer addressable space, shared memoryspace typically temporarily assigned to the writer constituent. A newwriter process is generally assigned a different address space. Forexample, in applications with writer processes sourced from program codeinstructions (e.g., C++ program code), a writer process is typicallyassigned a distinct writer addressable space each time the writerprocess starts or restarts. From the shared memory reader perspective, areader unique addressable space is typically also assigned for accessingshared memory locations for the reader to read writer published data.The reader addressable spaces are identified with reader raw pointers.The writer addressable space and the reader addressable space are twodistinct addressable spaces, each addressable space including one ormore regions (e.g. chunks of bulk memory) where each region starts at auniquely identifiable non-overlapping base address of a (writer orreader) process' address range. Readers of a common shared memory aretypically each assigned a distinct addressable space relative to otherreaders as well as to the shared memory writer for accessing sharedmemory locations. In this manner, writer pointers identify awriter-unique addressable space and reader pointers identify areader-unique addressable space at any given time. The writeraddressable space is fluid, typically, changing with each writer restartoperation whereas the reader addressable space remains static in theface of writer restart operations.

Indeed, the chances of preserving writer pre-restart operation pointersfor proper writer-addressable shared memory access in the event of awriter operation interruption, whether caused by a writer-encounteredissue or intentionally initiated, are rather slim to negligible. Asearlier indicated, before a writer restart operation, the writeraddressable space may be and typically is entirely different than afterthe writer restart operation, e.g., the former may be mapped to the baseaddress 0x1000 (in hexadecimal form) and the latter may be mapped to thebase address 0x2000. While preserving pre-restart (operation) writerpointers is typically not a viable option in conventional systems,preserving pre-restart shared memory contents, a shared memorypersistent characteristic, is a given in nearly all systems.

Writer published data (in shared memory) is precisely for readeraccessibility and consumption but when the reader tries to access sharedmemory contents based on pre-restart writer address pointers, the readeris clearly misled in attempting to access the data at old and incorrectshared memory locations, and sometimes without the reader's knowledge,often leading to system dysfunction. The writer and reader can beeffectively left without coordination in the aftermath of a writerrestart operation. Accordingly, shared memory-based system architecturescan be inadequately equipped for proper writer restart operations uponsystem power interruptions and disconnections.

In some prior art systems, to accommodate a writer restart process, thewriter pre-restart operation state is preserved, to be restored duringor after a post-restart operation but this is a memory-consuming venturerequiring continuous writer state preservation for the mere anticipationof a writer restart operation—a costly tradeoff

In some embodiments of the disclosure, the pre-restart (operation)writer pointers are preserved during a writer restart operation and thecorresponding pre-restart (operation) writer address space is translatedto a post-restart (operation) writer address space after the writerrestart operation providing reliable shared memory reader access duringand after the writer restart process. Shared memory readers haveconcurrent, lock-free, access to writer-published shared memory contentsduring a continuum of pre- and post-writer restart operation. The writershields the shared memory readers from the uncertainty associated withthe writer restart operation by implementing an intermediate stageprocess. Prior to the writer restart operation, a writer pointertranslation table is built in shared memory using pre-restart writerpointers. After the writer restart operation, the writer replaces thepre-restart writer pointers (of the pre-restart writer address space)with intermediate location independent pointers in shared memory, andultimately replaces the intermediate location independent pointers withpost-restart writer pointers. The writer pointer translation table isultimately populated exclusively with a modified version of post-restartwriter pointers when the writer completes replacing all intermediatelocation independent pointers with corresponding post-restart writerpointers.

In some cases, prior to the writer restart operation, shared memory datais published with pre-restart writer pointers of a pre-restart writeraddressable space, as it typically is, and after the restart operation,the pre-restart writer pointers are overwritten with temporary locationindependent pointers until the shared memory data is published with(new) post-restart writer pointers of a newly-assigned post-restartaddressable space. At any given time during the writer restart operationaddress space management, no more than a single pointer translationtable is processed, and no extra memory space is required.

In some embodiments, the shared memory is accessible to more than onereader and each reader performs independent, lock-free, and concurrentoperations on the shared memory contents relative to the writer and anyremaining shared memory readers. The concurrent readers remain workingon the shared memory all throughout the writer restart process,essentially oblivious to the process. Even after the writer restarts andresumes operation, while the writer is busy constructing new(post-restart) writer pointers, concurrent readers continue to reliablyperform respective reader operations on the shared memory data,blissfully ignorant of the writer restart process. Post restart, thewriter converts all pre-restart writer pointers to post-restart writerpointers without causing confusion or missteps to the readers. Thewriter constructs a new (post-restart) writer pointer translation tableindependently of reader operations or even any system interruptions at awriter preferred and natural pace without data loss risk or datamismanagement jeopardizing the reader.

For a short duration of the restart period, when the writer isnon-operational, readers carry on with normal reader operations, workingon pre-restart published shared memory contents with no new publishedwriter states until the writer resumes normal operation, post-restart.While readers may face some operational slowdown during this brief timeperiod, they remain generally unaffected by the writer restart operationenjoying free and reliable access to writer-published shared memorycontents through use of the intermediate and temporary locationindependent pointers.

Based on certain established writer-reader protocols, readersautomatically know to access the shared memory locations withpre-restart writer (raw) pointers, location independent pointers, orpost-restart writer (raw) pointers.

In some cases, for example, in state sharing memory systems, pre- orpost-restart writer raw pointers may point to locations of entries ofobjects in shared memory regions. The shared memory may be organizedinto regions where the writer may allocate, deallocate, create, delete,and in some cases modify entries of objects of the shared memoryregions. Each of the pre-restart writer addressable space and thepost-restart writer addressable space may correspond to randomlysituated regions of shared memory locations. When the writer restarts,all writer addressable shared memory regions may be mapped to anassigned writer address space distinct from the assigned writer addressspace prior to the writer restart operation. For example, a region 25 inshared memory may be mapped at a writer base address of 0x100000 priorto a writer restart operation and after the writer restarts, region 25may be mapped to a writer base address of 0x200000 yet concurrentreaders are made to keep up with writer publications regardless of thechange in the writer base address, seamlessly making reader progressprior, during, and after the restart process.

In accordance with an embodiment of the disclosure, a method ofprocessing memory address spaces corresponding to a shared memory isdisclosed. The process may be achieved in three stages in response to awriter restart operation. At stage one, the writer replaces thepre-restart writer pointers of a pre-restart writer addressable space inthe shared memory with corresponding location independent pointers. Thepre-restart writer pointers uniquely identify locations of entries inthe shared memory at the pre-restart writer addressable space employedby the writer to access the entries in the shared memory prior to thewriter restart operation. At stage two, the writer rebuilds a writerpointer translation table in the shared memory to replace an associationof modified pre-restart writer pointers and pre-restart translationpointers (based on the pre-restart writer pointers), respectively, withan association of modified post-restart writer pointers and post-restarttranslation pointers (based on post-restart writer pointers),respectively. The post-restart writer pointers uniquely identify thelocations of the entries in the shared memory at a post-restart writeraddressable space employed by the writer to access the entries in theshared memory after the writer restart operation. At stage three, thelast stage, the writer replaces the location independent pointers withthe post-restart writer pointers in the shared memory, respectively. Thepost-restart writer pointers are thereafter saved in the shared memoryfor continued shared memory access by one or more readers of the sharedmemory.

At each stage of the process, one or more concurrent readers traversethe shared memory contents with no adverse implications. In someregion-organized shared memory embodiments, a location independentpointer may uniquely identify a shared memory region. In some sharedmemory systems, the locations of shared memory regions are known to boththe writer and the reader. Accordingly, while at stages one and three,shared memory readers may translate writer pointers to reader pointers,during stage two of the process, there is no need for translation of thelocation independent pointers to reader pointers. That is, locationindependent pointers of the stage two process are not based on writer-or reader-assigned address spaces therefore requiring no in-sharedmemory translation to reader pointers. In some cases, the system mayexhibit higher performance during stages one and three relative to stagetwo due to the inherent fast-processing nature of raw pointers relativeto that of the location independent pointers.

In some embodiments, as previously noted, the writer pointers mayidentify entries in the shared memory. Objects of the entries may beorganized into a hierarchical state data structure and in some cases, anobject of a hierarchical state data structure may include one or moreother objects, for example, a collection of objects, and those objectsmay themselves include yet other nested objects or one or more othercollections of objects and so on.

In some embodiments, the writer pointers and the reader pointers areboth atomic in nature allowing the writer to concurrently and, in alock-free fashion modify any of the writer raw pointers while thereaders simultaneously access the same or other shared memory locations.

The atomic data unit characteristic of the writer and reader pointersensures that the reader reliably read data from shared memory locationscommon to the locations into which the writer may be publishing databecause either all or no part of the entirety of the atomic data unitcan change at any given time.

While the writer overwrites pre-restart writer pointers with locationindependent pointers, at stage two of the process, the readersnevertheless continue to make forward progress, even continuing withprocesses begun prior to the writer restart process. In someembodiments, during stage two, the reader is made aware of an addresspointer indicator type, set by the writer to direct the reader to ashared memory writer pointer translation table, or not. The readerdisambiguates writer raw pointers and location independent pointers.While the writer patches the pre-restart writer raw pointers withlocation independent pointers, each done one shared memory entry at atime, the reader is simultaneously made aware of the use ofcorresponding location independent pointers. Accordingly, the speed atwhich the writer overwrites the raw pre-restart pointers with rawpost-restart pointers is made irrelevant to the reader and forwardreader progress.

As earlier discussed, in some embodiments, at stage two of the restartprocess, the writer converts all pre-restart writer pointers to locationindependent pointers. In some cases, the location independent pointersmay point to regions and offsets of the shared memory, denoted byregion-offset pairs. Shared memory entries may be identified by regionidentifications, for example, each region identification identifying adistinct shared memory region. Offsets identify entries withincorresponding shared memory regions. in another example, regionidentifications may be eliminated entirely, and a location independentpointer may identify a single memory space occupied by a single region(in shared memory) with offset identifications identifying offsetswithin the single region rather than identification by region-offsetpairs. In some embodiments, location independent pointers are complexand not direct memory identifiers like raw pointers. For example, alocation independent pointer may be a hashed function.

Continuing with the stage two process discussion, the writer may walkthrough all the shared memory regions and build a new translation mapbased on region identifications and offset pairs of the shared memoryregions, but the writer does so from a writer post-restart perspective.As the translation table is being rebuilt with post-restart writerpointers, for each existing shared memory region, offset pair, in someembodiments, the writer changes the state of a corresponding addresspointer type indicator directing the readers to use the post-restartwriter pointers in place of the temporarily assigned locationindependent pointers. The reader then knows to resort to thecorresponding newly built (post-restart) table of writer pointers forprecise access to an addressed shared memory entry.

In some state sharing memory systems, each region entry may include aheader or metadata field in addition to the entry data. In an exampleapplication, the metadata field may include a region offset represented,for example, by a 32-bit or a 64-bit (binary) number but to instituteaddress alignment features, one or more of the offset bits may remainunchanged, for example, fixed at the value “0”, therefore carrying nomeaningful data. In some embodiments, the unused one or more bits, i.e.at the top or bottom of the 32-bit or 64-bit number, may be programmedto convey the address pointer type of a corresponding region entry. Forexample, when set, or reset, an address pointer type indicator mayrepresent a writer raw pointer type and when with an opposite polarity,reset, or set, respectively, the address pointer type indicator mayrepresent a location independent pointer type.

In some embodiments, the writer sets or resets an address pointer typeindicator of a corresponding entry in a shared memory locationsimultaneously with or after overwriting a pre-restart writer pointer ofthe corresponding entry with a location independent pointer. In someembodiments, the writer may set or reset an address pointer typeindicator simultaneously with or after overwriting a locationindependent pointer of a corresponding entry with a post-restart writerpointer.

In some state sharing embodiments implementing hierarchical state trees,a writer may determine object types of the objects of a hierarchicalstate tree, at stage one of the process. The object types may besubsequently the subject of stage two of the process for determininglocation independent pointers in several different optional manners. Insome embodiments, the writer may locate the object types based on a root(or “root object”) of a hierarchy. For example, a table, a queue, or alist of parent object addresses may be scanned to locate parent objectaddresses having a NULL value where a NULL value represents the root ofthe hierarchical state tree. Alternatively, the object entries of ahierarchy may be tagged for identification of the corresponding objecttype. Further details of a shared memory with hierarchical state datastructures having root objects, parent objects, and child objects can befound in U.S. patent application Ser. No. 16/886,692, titled “Lock-FreeMethod of Transmitting Hierarchical Collections Through Shared Memory”,filed on May 28, 2020, by Neilson, et al., the disclosure of which isincorporated by reference as though set forth in full.

In some cases, the layout of the entry data (e.g., object instances) isuseful to the writer in determining the location of object pointers(e.g., object pointers (also referred to herein as “writer pointers”,“raw writer pointers”, “pre-restart writer pointers”, and “post-restartwriter pointers”)). In some embodiments, the writer learns of the entrydata layout from the object type (e.g., a parent object or a childobject of a parent object). For example, the writer may find the rootobject of a hierarchy by use of a local writer root pointer. The writerroot pointer leads the writer to the root object in the shared memory.Finding the root of a hierarchy in shared memory reveals the root typeto the writer. For example, in an implementation, an object may have acorresponding parent object address, identifying the location of anobject in an immediately higher hierarchical level and in this scenario,a the parent address of the root object may indicate the object is aroot type of object based on a predetermined object address value (e.g.,a NULL value indicates the object is a root object). Accordingly, byhaving knowledge of the entry data layout, the writer is inherently madeaware of the location of the object pointers.

In some embodiments, the layout of a data entry is required to determinethe location of the object pointers in a hierarchical state datastructure. The object type may reveal the data layout in the hierarchy.To determine the object type, in some embodiments, the root object ofthe hierarchy is located and one or more pointers of the root objectpoint to the location of respective connecting objects which maythemselves include pointers to other objects of the hierarchy and so on.The writer has inherent awareness of the root object type and allobjects (e.g., child objects of parent objects) throughout thehierarchy, Further details of a parent-child hierarchy implementationmay be found in U.S. patent application Ser. No. 16/886,692 filed on May28, 2020, by Neilson et al, and titled “Lock-Free Method of TransmittingHierarchical Collections Through Shared Memory”, While in someembodiments, the object type may be determined by embedding extra typeinformation in each object data entry, in some embodiments, the objecttype may be determined without requiring embedding extra typeinformation in each object data entry. In still other implementations,the entry data may contain a type identifier, or another type of mappinginformation, for example, to enable the writer to perform a search in atype table to discover the location of the object pointers in the entryin which case the writer need not discover the hierarchy object roots todetermine all the object types in the hierarchy because each entry datacontains the necessary type information.

In some embodiments, after the completion of stage two of the writerrestart process when all pre-restart writer pointers are successfullyconverted to corresponding location independent pointers in sharedmemory, stage three of the process is consummated and the writerrebuilds the translation table from the perspective of the writer at thenew post-restart writer address space.

In some embodiments, a reader processes a reader memory address spacecorresponding to a shared memory by accessing an entry in the sharedmemory. The entry includes a corresponding writer pointer with acorresponding address pointer type indicator representing a writerpointer type or a location independent pointer type. The entry furtherincludes entry data written by a writer of the shared memory. Inresponse to the address pointer type indicator representing the writerpointer as a writer pointer type, the reader reads a translation pointerfrom a writer pointer translation table of the shared memory, thetranslation pointer is based on the writer pointer. The readerdetermines a local reader pointer based on the translation pointer; thelocal reader pointer uniquely identifies the location of the entry inthe shared memory at a reader addressable space employed by the readerto access the entry in the shared memory. In response to the addresspointer type indicator representing the writer pointer being a locationindependent pointer, the reader determines that the local reader pointeris based on the location independent pointer. The location independentpointer uniquely identifies the location of the entry in the sharedmemory at the reader addressable space employed by the reader to accessthe entry in the shared memory.

In various illustrated embodiments and related descriptions, a method ofmanaging address pointers of a writer agent (or “writer”), a producer toa shared memory common to a reader agent (“reader”) during a writerrestart process is disclosed. FIG. 1 shows an illustrative diagram of amemory management system. In FIG. 1, a memory management system 100 isshown to include a writer agent 102, shared memory 104, and a readeragent 106, in accordance with an embodiment of the disclosure. In someembodiments, each of writer agent 102 and reader agent 106 isimplemented in software, hardware, or a combination thereof. Sharedmemory 104 may be made of persistent memory, such as without limitation,non-volatile memory (e.g., FLASH), non-persistent memory, such aswithout limitation, random-access-memory (RAM), or a combinationthereof.

FIG. 1 shows the state of shared memory 104 at a first step (or stage),at a pre-writer restart memory state, prior to a three-step writerrestart process. The state of shared memory 104 may be at a pre-writerrestart memory state in anticipation of, immediately prior to a restartoperation of writer agent 102. Writer agent 102 may restart in responseto various events, for example, a system power-down and power-upsequence of events, an electrical disconnection and reconnection toshared memory 104, or other system interruption of sorts. As furtherdiscussed below, the embodiments of FIGS. 2 and 3 illustrate variouswriter restart memory state examples during a three-step (orthree-stage) writer restart process.

In some embodiments, writer agent 102 may be, in part or in whole,incorporated in shared memory 104. In some embodiments, writer agent 102resides wholly externally to shared memory 104, as shown in theembodiment of FIG. 1. Like the writer agent, reader agent 106 may be, inpart or in whole, incorporated in shared memory 104. In someembodiments, such as the embodiment of FIG. 1, reader agent 106 mayreside wholly externally to shared memory 104. While not shown in FIG.1, shared memory 104 may have additional consumers. For example, morethan one reader agent (other than reader agent 106) may be a consumer ofshared memory 104.

In some embodiments, shared memory 104 is configured to store distincttypes of information. For example, a first portion 104 a of sharedmemory 104 may store entries of data (or objects) and a second portion104 b of shared memory 104 may store associations, tables, or arrays ofinformation in relation to accessing the objects of the first portion104 a. It is understood that the division of shared memory 104 intofirst portion 104 a and second portion 104 b is largely conceptual andthat shared memory 104 may accommodate object (or data), object (ordata) information, and object (or data) accessing information with noshared memory partitioning or even with additional partitioning (agreater number of partitions than the two partitions 104 a and 104 b).For example, the objects of shared memory 104 may be organized in ahierarchical fashion, randomly distributed in shared memory 104 alongwith object access-related information. That is, the content of thefirst portion 104 a and the second portion 104 b may be commingled. Thecontent of the first portion 104 a and the second portion 104 b ofshared memory 104 may be partitioned into more than two portions. Forexample, the objects of the first portion 104 a may be organized intomore than one partition, the objects of the second portion 104 b may beorganized into more than one portion, or a combination thereof. In someembodiments, shared memory 104 comprises shared memory buffers in thefirst portion 104 a for storing entry objects and entry object accessinginformation (e.g., tables, arrays, and associations) in the secondportion 104 b. The shared memory buffers of the first portion 104 a ofthe shared memory may be allocated, in random or structured order, toentries of objects of a hierarchical state data structure. The firstportion 104 a shared memory buffers may be organized into regions ofshared memory locations including hierarchical state data structures,each with a corresponding one or more root objects. In some cases, thehierarchical state data structures include hierarchical levels ofobjects sprouting from a single root object. In the embodiment of FIG.1, shared memory 104 is shown to include a region, specifically, anexample region 25, including a hierarchical state data structure 136with a root object 110. In some embodiments, each of writer agent 102and reader agent 106 may include a corresponding root pointer foridentifying the location of root object 110. For example, writer agent102 may include writer root pointer 108 for identifying the location ofroot object 110 in shared memory 104 and reader agent 106 may includereader root pointer 130 for identifying the location of root object 110in shared memory 104.

In some embodiments, hierarchical state data structure 136 includes oneor more collections of entries, each entry including an object (orobject instance) of a logical representation of a system state. A systemstate of an entry may describe an attribute or a characteristic of asystem at any given time. For example, a system state may be based on anetwork route attribute like a protocol in a networking environment. Anobject is generally a language object that may include one or moretables and/or one or more processes. An object may be of various typesof objects, for example, an object may be a C++, Java, D, C#, and/orother types of language objects.

At least some of the collections of the hierarchical state datastructure 136 are organized into a hierarchy of objects entries. In someembodiment, hierarchical state data structure 136 may be a hierarchicalstate tree. In some embodiments, a multi-level hierarchical state datastructure (e.g. hierarchical state data structures 136, 236, 336 ofFIGS. 1, 2, 3, respectively) is a multi-level hierarchical state tree.The shared memory buffers of shared memory 104 may be used for storingsystem states of the multi-level hierarchical state data structure 136.The shared memory buffers of shared memory 104 may be updated inresponse to changes to the system states of hierarchical state datastructure 136. In some embodiments, an entry spans a single sharedmemory buffer of shared memory 104. Alternatively, an object entry mayspan more than one shared memory buffer of shared memory 104. An objectentry may be value-based, key-value based, or reference count-based. Forexample, in the embodiment of FIG. 1, the objects shown in ovals (e.g.,objects A-H) may each be reference count objects. In some embodiments,not all objects of a hierarchy are reference count objects and may bevalue-based, key-based, or a combination of the three, as previouslydiscussed. Each object of hierarchical state data structure 136 mayinclude one or more pointers with each of the object pointersidentifying the location of another object at a different hierarchicallevel of hierarchical state data structure 136. In this manner, the twoobjects are linked. Not all objects of a hierarchical state datastructure necessarily include a pointer. For example, object A 112,object D 118, object F 122, object G 126, and object H 128 ofhierarchical state data structure 136 are each shown without a pointerand therefore without a connection to another object.

In the embodiment of FIG. 1, hierarchical state data structure 136 is amulti-level hierarchical structure of objects, namely objects A-H,situated at different levels of the hierarchy and originating from rootobject 110. While the embodiment of FIG. 1 shows hierarchical state datastructure 136 to include a specific number of objects organized at aspecific number of hierarchical levels, it is understood thathierarchical state data structure 136 may include a different number ofobjects organized at a different number of hierarchical levels. Theobjects at different hierarchical levels of hierarchical state datastructure 136 (including root object 110) are linked by pointers. Forexample, assuming root object 110 defines the first hierarchical levelof hierarchical state data structure 136, object A 112, object B 114,and object C 116 are at the second hierarchical level of hierarchicalstate data structure 136; object D 118, object E 120, and object F 122are at the third hierarchical level of hierarchical state data structure136; and object G 126 and object H 126 are the fourth hierarchical levelof hierarchical state data structure 136. The pointers of the foregoingobjects are each a raw writer pointer at the stage of the writer restartoperation (pre writer restart operation) shown in the embodiment of FIG.1—pre-restart writer pointers. For example, root object 110 is shown toinclude three raw writer pointers, namely pre-restart writer pointer 0,pre-restart writer pointer 1, and pre-restart writer pointer 2; object Bis shown to include two raw writer pointers, namely, pre-restart writerpointer 3, and pre-restart writer pointer 4; object E is shown toinclude two raw writer pointers, namely, pre-start writer pointer 5 andpre-start writer pointer 6; and object C is shown to include one rawwriter pointer, namely, pre-restart writer pointer 7. The writer employsan object pre-restart writer pointer for linking the object to a nexttier hierarchy in the hierarchical state data structure.

As previously discussed, writer agent 102 is a producer to shared memory104 and writes state entry data to regions of shared memory 104, andreader agent 106 is a state consumer of shared memory 104 and reads thestate entry data written to shared memory 104. For example, in theembodiment of FIG. 1, writer agent 102 may write data to region 25 ofthe first portion 104 a of shared memory 104, reader agent 106 mayconsume the data written to region 25 by writer agent 102. In someembodiments, each agent locates a hierarchical state data structure in aregion of shared memory 104 using the corresponding hierarchy rootobject. For example, as previously indicated, writer agent 102 maylocate hierarchical state data structure 136 in shared memory 104 withwriter root pointer 108 and reader agent 106 may locate hierarchicalstate data structure 136 in shared memory 104 with reader root pointer130. Each of the writer root pointer 108 and reader root pointer 130point to root object 110 of shared memory 104. Having located thehierarchy root object, each agent then finds linked objects, if any, inthe next immediately following hierarchical tier using the pointers ofthe root object and find objects, if any, of the following hierarchicaltier using the pointers of the immediately preceding hierarchical tierand so on. For example, writer agent 102 and reader agent 106 eachlocate hierarchical state data structure 136 by locating root object110, the address of which is maintained by each agent. By finding rootobject 110, each agent 102 and 106 may locate object A 112 bypre-restart writer pointer 0 of root object 110. Similarly, object B 114may be located by use of the pre-restart writer pointer 1 from rootobject 110; object C may be located by use of the pre-restart writerpointer 2 from root object 110; object D may be located by use of thepre-restart writer pointer 3 from object B 114; object E 120 may belocated by use of the pre-restart writer pointer 4 from object B 114;object G 126 may be located by use of the pre-restart writer pointer 5from object E 120, and so on.

In some embodiments, writer agent 102 may operate on shared memory 104concurrently while reader agent 106 (and possibly additional readeragents not shown in FIG. 1) consumes data from or simply monitors sharedmemory 104. Similarly, reader agent 106 (and possibly additional readeragents not shown in FIG. 1) may read states from shared memory 104concurrently relative to possibly other shared memory readers as well asrelative to writer agent 102. In some embodiments, writer agent 102 is aprocess implemented by execution of program (software) code by one ormore processors. Similarly, reader agent 106 may be a processimplemented by execution of program code by one or more processors.Reader agent 106 may read an entry (data), representing a system state,stored in shared memory 104 via a corresponding reader manager not shownin FIG. 1. In some embodiments, reader agent 106 performs readoperations in a lock-free and wait-free fashion. While the writermodifies shared memory data, the reader may concurrently read sharedmemory data. Accordingly, shared memory 104 data may be independentlyaccessed by the one or more readers without regard to writer agent 102and without regard to the remaining shared memory reader agents.Similarly, removal of objects of the hierarchical state data structure136 in shared memory 104 may be done independently and without effect toreader agent 106, by writer agent 102.

In some embodiments, writer agent 102 may perform operations on datastructure 136 through a writer manager not shown in FIG. 1. For example,a writer manager may serve as a conduit from writer agent 102 to sharedmemory 104 for allocating and deallocating object entry memory spacesamong other care taking operations as discussed herein. In someembodiments, system 100 is absent a writer manager, as shown in FIGS.1-3, and writer agent 102 allocates, deallocates object entry memoryspaces among performing other shared memory-related tasks.

One of the features of system 100 supporting the independent operationof agents 102 and 106, in addition to possibly other reader agents, onshared memory 104 is the distinct addressable space assigned to eachagent at any given time. In some embodiments, assignment of anaddressable space may be performed by a writer manager that may be inpart or in whole incorporated in the writer agent or may resideexternally to the writer agent. For example, the writer manager may makea request to a bulk memory for a chunk of memory and may then assign thechunk of memory to the addressable space. In some embodiments, anaddressable space is assigned to writer agent 102 prior to a writerrestart operation (pre-restart writer addressable space). For example,in the embodiment of FIG. 1, the pre-restart writer addressable spacewith region 25 starts at base address 0x1000 (in hexadecimal format).That is, to access region 25 of hierarchical state data structure 136 ofshared memory 104, writer agent 102 employs address 0x1000. In anembodiment, address 0x1000 may be the base address for identifying thefirst location of hierarchical state data structure 136 by writer agent102. Analogously, in some embodiments, an addressable space is assignedto reader agent 106 prior to a writer restart operation (pre-restartreader addressable space). For example, in the embodiment of FIG. 1, thepre-restart reader addressable space for region 25 starts at baseaddress 0x10000 (in hexadecimal format). That is, to access region 25 ofhierarchical state data structure 136 of shared memory 104, reader agent106 employs address 0x10000. In an embodiment, address 0x10000 may bethe base address for identifying the first location of hierarchicalstate data structure 136 by reader agent 106. In some embodiments, eachof the writer and reader address space assignments may be made by acorresponding agent manager. In some embodiments, the writer/readeraddress space assignments may be performed automatically. For example,the Linux kernel may automatically provide the address spaceassignments.

In some embodiments, the second portion 104 b of shared memory 104includes one or more writer pointer translation tables. In theembodiment of FIG. 1, the second portion of shared memory 104 is shownto include a writer pointer translation table 124. It is understood thatthe second portion 104 b of shared memory 104 may include one or moretables in addition to table 124 or table 124 may comprise more than onetable, or a combination thereof. The tables of the second portion 104 bof shared memory 104 maintain associations of modified pre-restartwriter pointers and pre-restart translation pointers based on thepre-restart writer pointers of the first portion 104 a of shared memory104, respectively. Alternatively, or additionally, the tables of secondportion 104 b may maintain associations of the pre-restart writerpointers of the first portion 104 a of shared memory 104 and pre-restarttranslation pointers. In the embodiment of FIG. 1, table 124 maintainsan association of modified pre-restart writer pointers and pre-restarttranslation pointers. Table 124 may maintain an association of modifiedpre-restart writer pointers and pre-restart translation pointers insteadof an association of the pre-restart writer pointers and pre-restarttranslation pointers for various reasons, such as without limitation, tocover an extended number of associations of prestart writer pointers orto reduce the size of each pre-start writer pointer to be maintained inshared memory for cost-effectiveness. For example, the modifiedpre-restart writer pointers may be a truncated version of correspondingpre-restart writer pointers of the first portion 104 a of shared memory104 with each modified pointer requiring less memory space. Theassociations of the second portion 104 b may be based on modifiedpre-restart writer pointers of the first portion 104 a on a memory pageboundary basis. For example, each of the modified pre-restart writerpointers may be a truncation of a corresponding pre-restart writerpointer by several bits defining a page size. The modified pre-restartwriter pointers of table 124 need not be a truncation of the pre-restartwriter pointers of the first portion 104 a of shared memory 104 and mayinstead be a different type of modification of the pre-restart writerpointers. For example, the modified pre-restart writer pointers of table124 may be assigned based on a certain pattern of assignments inconnection with the pre-restart writer pointers of the first portion 104a of shared memory 104.

In the embodiment of FIG. 1, each of the modified pre-restart writerpointers of table 124 is a 12-bit truncation of a correspondingpre-restart writer pointer of the objects of the first portion 104 a ofshared memory 104. Table 124 is indexed by the modified pre-restartwriter pointers (post truncation of the pre-restart writer pointers.)For example, modified pre-restart writer pointer 0 of table 124 is a12-bit truncation of pre-restart writer pointer 0 of root object 110.That is, writer agent shifts the pre-restart writer pointer 0 to theright by 12 bits to generate the modified pre-restart writer pointer 0of table 124. The 12 truncated lowest significant bits (LSBs),representing an addressable range of 4 kilo bytes (Kbytes) in decimalnotation, correspond to a 4 Kbyte-page size in shared memory firstportion 104 a. Accordingly, the information in table 124 pertains to Nnumber of shared memory pages, “N” being an integer value. It isunderstood that writer agent 102 may truncate each pre-restart writerpointer by more than or less than 12 bits to accommodate a differentpage size. In some embodiments, writer agent 102 may truncate thepre-restart writer pointer by the most significant bits (MSBs), forexample, irrespective of page size.

The modified pre-restart writer pointers of table 124 index pre-restarttranslation base pointers of table 124. For example, modifiedpre-restart writer pointer 0 serves as index to pre-restart translationbase pointer 0; modified pre-restart writer pointer 1 serves as index topre-restart translation base pointer 1; modified pre-restart writerpointer 2 serves as index to pre-restart translation base pointer 2, andso on. In some embodiments, each of the rows of table 124, i.e.,pre-restart translation base pointers, identifies a base pointer of acorresponding addressed page in shared memory 104. For example,pre-restart translation base pointer 0, in table 124, may be the firstpointer of a corresponding page with the next pointer calculated byincrementing the base pointer by one and the following pointer similarlycalculated by incrementing the previous pointer by one and so on. Insome embodiments, each of the pre-restart translation base pointers oftable 124 identifies a region and offset pair location of acorresponding object in the first portion 104 a of shared memory 104.For example, pre-restart translation base pointer 0 of table 124 may bea pointer to the first location (offset ‘0’ or offset ‘1’) in region 25of hierarchical state data structure 136. In this respect, thepre-restart translation base pointers of table 124 are shared memorylocation-dependent pointers and correspond to the pre-restart writeraddressable space (e.g., 0x1000). Accordingly, reader agent 106translates each writer pointer to a local reader addressable space. Forexample, each of the pre-restart translation base pointers of table 124may be translated to the pre-restart reader addressable space 0x10000.Each row of table 124 includes a distinct pre-restart translation basepointer for each page.

In an example operation, writer agent 102 maintains an association ofmodified pre-restart writer pointers and pre-restart translation basepointers at table 124. Writer agent 102 may write a pre-restart writerpointer, for example, pre-restart writer pointer 0, of a correspondingobject, for example, root object 110, with the pre-restart writerpointer pointing to a location in shared memory 104 for identifying anobject linked to root object 110, for example, object A 112. Writeragent 102 may record the new home of the pre-restart writer pointer or amodified version in table 124. For example, writer agent 102 may modifythe pre-restart writer pointer by shifting the pre-restart writerpointer 0 by 12 bits to the right, and using the modified pre-restartwriter pointer, for example, modified pre-restart writer pointer 0,write a corresponding pre-restart translation base pointer, for example,pre-restart translation base pointer 0, to table 124. In someembodiments, a pre-restart translation base pointer is a two-fieldvalue, one field is the writer's base address of the region and theother field is a region identification that indicates a location withinthe region. From this two-field information, the reader agent mayperform a local lookup of region 25 and calculate the local readeraddress pointer. In some embodiments, the location of objects in sharedmemory 104 may be identified by other mechanisms instead of with thewriter base address of the region and the region identification. In someembodiments, the writer base address of the region may be offset 0.Alternative ways of identifications of object locations in table 124 andfurther details of the region, offset pair identification can be foundin U.S. Patent Publication No. 2020/0104196, published on Apr. 2, 2020,filed on Jul. 19, 2019, by Ritchie et al., and titled “System and Methodof a Shared Memory Allocator”, the disclosure of which is incorporatedby reference as though set forth in full.

To access the writer-published data, reader agent 106 accesses rootobject 110 and reads a corresponding pre-restart writer pointer, forexample, pre-restart writer pointer 0 pointing to object A 112. Readeragent 106 is aware of the pre-restart writer pointer's correspondencewith a restart writer addressable space although the reader agent doesnot necessarily know or need to know exactly the specific restart writeraddressable space. Stated differently, reader agent 106 knows totranslate the pre-restart writer pointer to a reader pointer based onthe pre-restart reader addressable space. Reader agent 106 firstmodifies the pre-restart writer pointer (e.g., pre-restart writerpointer 0) by shifting the pre-restart writer pointer to the right by 12bits to determine the corresponding modified pre-restart writer pointer(e.g., pre-restart writer pointer 0). Reader agent 106 looks up thecorresponding pre-restart translation base pointer (e.g., pre-restarttranslation base pointer 0) in table 124, which in some embodiments, maybe region-based, and now knows the region identification of thepre-restart writer pointer (e.g., 25). Reader agent 106 performs a localtranslation of the pre-restart translation base writer pointer (e.g.,pre-restart translation base writer pointer 0) to reader pointer basedon the restart reader addressable space (0x10000), for example, inaccordance with a method (huge-map, page-map, . . . ) disclosed in thepatent document referenced above. Reader agent 106 may perform the localtranslation using a different method, one that is not disclosed in theabove-referenced patent document, nevertheless suitable for translatingthe reader pointer from table 124 to a pointer based on the readeraddressable space.

In some embodiments, writer agent 102 writes an address pointer typeindicator when writing the pre-reset writer pointer in root object 110or thereafter. The address pointer type indicator represents the type ofpointer the writer agent is writing. For example, the address pointertype indicator may represent two distinct types of pointers, one that isa raw writer pointer (e.g., pre-restart writer pointer) and another thatis a location independent pointer. The location independent pointer(LIP) is not necessarily region or location dependent. In someembodiments, a LIP is a hash value maintained in a hash table, such astable 132 in reader agent 106. Further details of LIPs, the conversionof pre-restart writer pointers to LIPs, and the conversion of LIPs topost-restart writer pointers are provided in the patent documentreferenced above. Table 132 may be maintained externally to reader agent106. In comparison to raw pointers, LIPs pose a slower lookup processand are therefore employed on a temporary basis as an intermediateprocess for allowing the readers of shared memory 104, such as reader106, to proceed with working on shared memory data without interruptionin response to a writer restart operation, as previously discussed.

FIGS. 2-3 each shows an illustrative diagram of a memory managementsystem. In FIG. 2, a memory management system 200 is shown to include awriter agent 202, shared memory 204, and a reader agent 206, inaccordance with an embodiment of the disclosure. In FIG. 3, a memorymanagement system 300 is shown to include a writer agent 302, sharedmemory 304, and a reader agent 306, in accordance with an embodiment ofthe disclosure. The embodiments of FIGS. 1-3 collectively show thefirst, second, and third steps (or stages), of a writer restartoperation, in accordance with various embodiments and methods of thedisclosure. As such, reference is made to these figures in the followingdescription.

As previously stated, the state of the shared memory prior to a writerrestart operation is shown in FIG. 1. During or immediately after awriter restart operation, an example of an interim writer restart memorystate is shown in FIG. 2. After a writer restart operation, the writeragent, shown in system 200 as a writer agent 202, rebuilds the writerpointer translation table in the shared memory to replace theassociation of modified pre-restart writer pointers and pre-restarttranslation base pointers based on the pre-restart writer pointers,respectively, with an association of the modified post-restart writerpointers and post-restart translation pointers based on the post-restartwriter pointers, respectively. The post-restart writer pointers uniquelyidentify the locations of entries in the shared memory at a post-restartwriter addressable space (e.g., 0x2000 in FIGS. 2, 3) that is employedby the writer agent to access the entries in the shared memory after thewriter restart operation. Analogously, the pre-restart writer pointersuniquely identify the locations of entries in the shared memory at apre-restart writer addressable space (e.g., 0x1000 in FIG. 1) that isemployed by the writer to access the entries in the shared memory priorto the writer restart operation (shown in FIG. 1). For example, and withreference to FIGS. 2-3, the post-restart writer addressable space is0x2000 whereas the pre-restart writer addressable space was 0x1000 (FIG.1). The writer agent (writer agent 202 and writer agent 302) replaceseach of the pre-restart writer pointers in the hierarchical state datastructure 136 with a corresponding LIP to guard against the readers ofshared memory 204 (or shared memory 304 of FIG. 3) accessing the entrydata written by the writer to shared memory to prevent adverserepercussions. With particular reference to FIG. 2, showing step 2 ofthe restart process, writer agent 202 has replaced pre-restart writerpointer 0, pre-restart writer pointer 1, pre-restart writer pointer 2,and pre-restart writer pointer 3 of the embodiment of FIG. 1 with LIP 0,LIP 1, LIP 2, and LIP 3, respectively, while writer agent 202 has yet toreplace pre-restart writer pointer 4, pre-restart writer pointer 5,pre-restart of writer pointer 6, and pre-restart writer pointer 7 withcorresponding LIPs. Reader agent 206 has the requisite knowledge toaccess the entry data despite the pointer difference, as furtherdiscussed below.

Replacing the pre-restart writer pointers with interim LIPs allows thewriter agent to work at a convenient pace in rebuilding the writerpointer translation table (e.g., table 224) in shared memory 204 (or 304in FIG. 3) with post-restart writer pointers. In the meanwhile, thecontents of writer pointer translation table 224 of FIG. 2 remain thesame as the contents of table 124 of FIG. 1. Accordingly, readers of theshared memory (e.g., reader agent 206 of FIG. 2 and reader agent 306 ofFIG. 3) have free and unlimited access to and can consume data fromshared memory 204 in a lock-free, concurrent, and wait-less manner,regardless of the number of readers and regardless of the activity inwhich the writer (writer agent 202 of FIG. 2 and writer agent 302 ofFIG. 3) may be engaged.

In some embodiments, at step 3 in the restart process, the writer agentreplaces the temporary LIPs with post-restart writer pointers in theshared memory, respectively. In some embodiments of the disclosure, uponcompletion of replacing the pre-restart writer pointers of FIG. 1 withLIPs, as discussed above, writer agent 302 of FIG. 3 replaces the LIPswith the post-restart writer pointers and the post-restart writerpointers are based on the newly assigned restart writer addressablespace, a space reassigned to writer agent 302 after the restartoperation. For example, LIP 0 of FIG. 2 is replaced with post-restartwriter pointer 0, LIP 1 of FIG. 2 is replaced with post-restart writerpointer 1, and so on.

Notably, the contents of writer pointer translation table 224 areaffected after the writer restart operation and particularly after allpre-restart writer pointer-to-LIP conversion for all objects of sharedmemory 204 has been performed. After the restart process, the writeragent may generate a new set of modified writer pointers based on thenewly assigned (post-) restart writer addressable space (e.g., 0x2000).For example, writer agent 302 (FIG. 3) may modify the post-restartwriter pointer 0 of the second portion 104 b of shared memory 104 bytruncating the 12 LSBs of the post-restart writer pointer 0 and use theremaining MSBs of the post-restart writer pointer 0 to index table 324.Writer agent 302 populates writer pointer translation table 324 of FIG.3 with corresponding post-restart translation base pointers, indexed byrespective modified post-restart writer pointers, accordingly. In someembodiments, each post-restart translation base pointer uniquelyidentifies a post-restart writer base address and a corresponding regionidentification, as described above relative to FIG. 1. In someembodiments, writer agent 302 may index table 324 with non-modifiedpost-restart writer pointers. Accordingly, in some embodiments, writeragent 302 stores the post-restart writer pointers in the second portion104 b of the shared memory for access by one or more readers of theshared memory (e.g., shared memory 304). The pre-restart readeraddressable space (e.g., 0x10000) remains unchanged after the writerrestart process.

FIG. 4 shows an illustrative diagram of an example entry field structure400 of some embodiments of the disclosure. An entry may include anobject (or data or object data) in addition to other information, suchas metadata and address pointers. In FIG. 4, an entry is shown toinclude an entry metadata field 402, an entry data field 404, and anentry writer pointer field 406. Each entry may belong to a hierarchicalstate data structure. For example, the entry of

FIG. 4 belongs to hierarchical state data structure 136 of FIGS. 1, 2,and 3.

The pointers of FIG. 4 follow the example of FIG. 2 in that objects withone or more pointers (raw or LIP), in FIG. 4, correspond to objects withpointers in FIG. 2. For example, in accordance with the memory state ofFIG. 2, some of the pre-restart writer pointers of various objects ofhierarchical state data structure 136 are converted to LIPs and some ofthe pre-restart writer pointers remain the same. Specifically, thepre-restart writer pointers (pre-restart writer pointers 0-2, shown withcorresponding metadata 0 and data 0 in FIG. 4) are converted to LIPs(LIPs 0-2), respectively, while the pre-restart writer pointers(pre-restart writer pointer 5 and pre-restart writer pointers 6, shownwith corresponding metadata 2 and data 2 in FIG. 4) remain aspre-restart writer pointers.

In some embodiments, the LSB of the LIP or raw writer pointer is used toindicate the pointer type. That is, the entry writer pointer field 406of FIG. 4 includes either a writer pointer or a LIP with an LSBrepresenting the address pointer type indicator discussed above. Aspreviously noted, the address pointer type indicator need not berepresented by the LSB of the writer pointer or LIP and can be at adifferent bit location of the writer pointer or LIP. In someembodiments, the address pointer type indicator is writtensimultaneously with the writer pointer or LIP, as the case may be, bythe writer agent. Specifically, in embodiments where the address pointertype indicator is a part of the writer pointer and the LIP, such as theembodiment of FIG. 4, the address pointer type indicator is writtensimultaneously with the writer pointer and the LIP. In embodiments withsimultaneous writing of the writer pointer and the address pointer typeindicator, readers enjoy a lock-free and wait-less consumptionexperience. In some embodiments, the address pointer type indicator neednot be written simultaneously with the writer pointer or the LIP and canbe written after the writer pointer or the LIP are written. For example,writer agent 302 (in FIG. 3) may write the writer pointer or LIP andthereafter write the address pointer type indicator. In some cases, anindicator, such as a bit or a flag, may be set to indicate whether theaddress pointer type indicator has been written by the writer agent, forexample.

FIG. 5 shows a flowchart of an illustrative process 500 for performing awriter memory address process, in accordance with some embodiments ofthe disclosure. In some embodiments, process 500 may be implemented bysystems 100, 200, and 300 of FIGS. 1, 2, and 3. In some embodiments,process 500 may be implemented by writer memory address processingsystems other than those shown and described herein. In an exampleembodiment, a writer, such as writer agent 102, 202, or 302 of FIG. 1,2, or 3, respectively, may carry out the steps of process 500.

In the interest of simplicity of illustration, the writer agent of FIG.3 is referenced below in reference to a discussion of process 500. Atstep 502, writer agent 302 begins a writer memory address process. Atstep 504, writer agent 302 is at a pre-restart operation stateresembling the state of FIG. 1 with pre-restart writer pointers 0-7based on pre-restart write addressable space (e.g., 0x1000). In responseto a writer restart operation, process 500 proceeds to step 506. At step506, writer agent 302 (FIG. 3) replaces the pre-restart writer pointersof step 506 with LIPs, as shown in FIG. 2. Upon completion of thepre-restart writer pointers conversion to LIPs at step 506, process 500performs step 508. At step 508, writer agent 302 rebuilds the writerpointer translation table (e.g., table 324) and at step 510, after thecompletion of rebuilding the writer pointer translation table at step508, writer agent 302 replaces the LIPs of the shared memory withpost-restart writer pointers based on the newly assigned (post-restart)writer addressable space (e.g., at 0x2000). Accordingly, thepost-restart writer pointers of step 510 of the objects of hierarchicalstate data structure 136, for example, of system 300 replacecorresponding pre-restart writer pointers of system 100. In someembodiments, the post-restart writer pointers are stored in the sharedmemory for access by one or more readers of the shared memory.

FIG. 6 shows a flowchart of an illustrative process 600 for performing areader memory address process, in accordance with some embodiments ofthe disclosure. At step 602 of process 600, the reader agent begins amemory address process. At step 604, the reader agent accesses an entrywith an address pointer type indicator in shared memory. For example,with reference to FIG. 3, reader agent 306 may address an entry ofhierarchical state data structure 326, at step 604 (e.g., the entry ofroot object 110). At step 606, reader agent 306, having read a pointer(whether a pre-restart writer pointer or a LIP), determines whether theaddress pointer type indicator simultaneously read with the pointerrepresents a raw writer pointer or a LIP and in response to the readeragent determining that the address pointer type indicator represents awriter pointer type, process proceeds to step 608, otherwise, process600 proceeds to step 612. At step 608, the reader agent reads thetranslation base pointer from the shared memory writer pointertranslation table (e.g., table 324) and at step 610, the reader agentdetermines the local reader pointer to translate the read translationbase pointer to a local reader pointer based on the post-restart (orpre-restart since the reader addressable space remains unchanged before,during and after the writer restart operation) reader addressable space(e.g., 0x10000). In determining, at step 606, that the address pointertype indicator does not represent a writer pointer type, or indetermining at step 606, that the address pointer type indicator is aLIP type, process 600 proceeds to step 612. At step 612, the readeragent determines the local reader pointer based on the LIP and may forgoresorting to the writer pointer translation table (e.g., table 324).

Although a particular order and flow of steps is depicted in each ofFIGS. 5-6, it will be understood that in some embodiments one or more ofthe steps in each figure may be suitably modified, moved, removed, oradded, and that the flow depicted in these figures may be modified.

FIG. 7 shows a generalized embodiment of a network device 700. Networkdevice 700 may be a router, a switch, and/or any other network deviceconfigured as systems 100, 200, and 300 of FIGS. 1, 2, and 3,respectively, with a shared memory with data produced by writer agents(e.g., writer agents 102, 202, and 302 of FIGS. 1, 2, and 3,respectively) addressing entries of objects hierarchically organized inthe shared memory, the objects logically representing respective systemstates. Network device 700 may receive via a network interface (e.g.,network interface 710A), network traffic route configuration data,dynamically changing to reflect the dynamic route configuration of acorresponding network traffic, store the configuration data as systemstates in the form of hierarchical state data structures of objects oflogical representation of the changing system states (e.g., hierarchicalstate data structure 136, 236, and 336 of FIGS. 1, 2, 3, respectively)in storage 708 for readers of storage 708. In some embodiments, networkdevice 700 performs storage of the hierarchical data structures withcontrol circuitry 704, which includes processing circuitry 706 andstorage 708. In some embodiments, storage 708 may be configured as ashared memory, for example, shared memory 104, 204, or 304 of FIG. 1, 2,or 3, respectively. In some embodiments, execution of a writer programcode, stored in storage 708, by processing circuitry 706, implements awriter agent (e.g., writer agent 102, 202, 302 of FIGS. 1, 2, 3,respectively) of the shared memory. In some embodiments, execution of areader program code, stored in storage 708, by processing circuitry 706,implements a reader agent (e.g., reader agent 106, 206, 306 of FIGS. 1,2, 3, respectively) of the shared memory.

While network device 700 is shown as including four network interfaces(e.g., network interfaces 710A, 710B, 710C, and 710D), this is merelyillustrative, and those skilled in the art will appreciate that networkdevice 700 may include any number of network interfaces, and that thenetwork interfaces may be of any type of wired or wireless networkinterface, such as RJ45 ethernet ports, a coaxial ports, logical ports,wireless interfaces (e.g., 802.11x interfaces, BLUETOOTH interfaces,cellular interfaces, etc.)

Control circuitry 704 may be based on any suitable processing circuitry,such as processing circuitry 706. As referred to herein, processingcircuitry should be understood to mean circuitry based on one or moremicroprocessors, microcontrollers, digital signal processors,programmable logic devices, field-programmable gate arrays (FPGAs),application-specific integrated circuits (ASICs), etc., and may includea multi-core processor (e.g., dual-core, quad-core, hexa-core,octa-core, or any suitable number of cores). In some embodiments,processing circuitry is distributed across multiple separate processorsor processing units, for example, multiple of the same type ofprocessing units (e.g., two INTEL CORE i7 processors) or multipledifferent processors (e.g., an INTEL CORE i5 processor and an INTEL COREi7 processor). In some embodiments, control circuitry 704 executesinstructions for performing various operations as a producer wouldperform on a shared memory, as described above with reference to FIGS.1-3. For example, control circuitry 704 may perform the writer processesor certain writer steps of the processes of FIG. 5. In some embodiments,control circuitry 704 executes instructions for performing variousoperations as a consumer would perform on a shared memory, as describedabove with reference to FIGS. 1-3. For example, control circuitry 704may perform the reader processes or certain reader steps of the processof FIG. 6.

Storage 708 may include volatile random-access memory (RAM) 712, whichdoes not retain its contents when power is turned off, and non-volatileRAM 714, which does retain its contents when power is turned off. Insome embodiments, storage 708 may be an electronic storage device thatis part of control circuitry 704. As referred to herein, the phrase“electronic storage device” or “storage device” should be understood tomean any device for storing electronic data, computer software,instructions, and/or firmware, such as random-access memory,content-addressable memory, hard drives, optical drives, solid statedevices, quantum storage devices, or any other suitable fixed orremovable storage devices, and/or any combination of the same. In someembodiments, one or more writer pointer translation tables 124, 224, 324of FIGS. 1, 2, 3, respectively are stored in storage 708. In otherembodiments, one or more of the writer pointer translation tables 124,224, 324 may be stored on a separate device and a link to acorresponding may be stored in storage 708. In some embodiments, a rootobject, such as root object 110, root object 210, or root object 310,may be stored in storage 708. In some embodiments, a root object, suchas root objects 110, 210, or 310, may be stored on a separate device anda link to the root object may be stored in storage 708. In someembodiments, one or more hierarchical state data structures, such ashierarchical state data structures 136, 236, 336 or FIGS. 1, 2, and 3,may be stored in storage 708. In some embodiments, one or more readerhierarchical state data structures, such as hierarchical state datastructures 136, 236, 336, may be stored on a separate device and a linkto the root object may be stored in storage 708. The circuitry describedherein may execute instructions included in software running on one ormore general purpose or specialized processors. Multiple circuits may beprovided to handle simultaneous processing functions.

It will be apparent to those of ordinary skill in the art that methodsinvolved in the present invention may be embodied in a computer programproduct that includes a computer-usable and/or -readable medium. Forexample, such a computer-usable medium may consist of a read-only memorydevice, such as a CD-ROM disk or conventional ROM device, or arandom-access memory, such as a hard drive device or a computerdiskette, having a computer-readable program code stored thereon. Itshould also be understood that methods, techniques, and processesinvolved in the present disclosure may be executed using processingcircuitry.

The processes discussed above are intended to be illustrative and notlimiting. More generally, the above disclosure is meant to be exemplaryand not limiting. Only the claims that follow are meant to set bounds asto what the present invention includes. Furthermore, it should be notedthat the features and limitations described in any one embodiment may beapplied to any other embodiment herein, and flowcharts or examplesrelating to one embodiment may be combined with any other embodiment ina suitable manner, done in different orders, or done in parallel. Inaddition, the systems and methods described herein may be performed inreal time. It should also be noted, the systems and/or methods describedabove may be applied to, or used in accordance with, other systemsand/or methods.

What is claimed is:
 1. A method of processing memory address spacescorresponding to a shared memory comprising: in response to a writerrestart operation: replacing a plurality of pre-restart writer pointersof a pre-restart writer addressable space in the shared memory with acorresponding plurality of location independent pointers, wherein: theplurality of pre-restart writer pointers uniquely identifies locationsof entries in the shared memory at the pre-restart writer addressablespace employed by a writer to access the entries in the shared memoryprior to the writer restart operation; rebuilding a writer pointertranslation table in the shared memory to replace an association ofmodified pre-restart writer pointers and pre-restart translation basepointers based on the plurality of pre-restart writer pointers,respectively, with an association of modified post-restart writerpointers and post-restart translation base pointers based on a pluralityof post-restart writer pointers, respectively, wherein: the plurality ofpost-restart writer pointers uniquely identifies the locations of theentries in the shared memory at a post-restart writer addressable spaceemployed by the writer to access the entries in the shared memory afterthe writer restart operation; replacing the plurality of locationindependent pointers with the plurality of post-restart writer pointersin the shared memory, respectively; and storing the plurality ofpost-restart writer pointers in the shared memory for access by one ormore readers of the shared memory.
 2. The method of claim 1, wherein theplurality of pre-restart writer pointers in the shared memory arereplaced with the plurality of post-restart writer pointers using theplurality of location independent pointers, respectively, such that theone or more readers of the shared memory can access the entries whilethe plurality of pre-restart writer pointers are replaced with theplurality of post-restart writer pointers in the shared memory.
 3. Themethod of claim 1, wherein the locations of the entries in the sharedmemory are identifiable to the one or more readers of the shared memorybased on the pre-restart translation base pointers prior to the writerrestart operation and the locations of the entries in the shared memoryare identifiable to the one or more readers of the shared memory basedon the post-restart translation base pointers after the writer restartoperation.
 4. The method of claim 1, wherein at least a portion of theshared memory is organized into one or more regions including theentries and the method further comprises determining the plurality oflocation independent pointers based on, at least in part, regionidentifications uniquely identifying corresponding regions of the sharedmemory.
 5. The method of claim 4, wherein determining the plurality oflocation independent pointers is further based on offsets to theregions, wherein an offset of a corresponding region distinctlyidentifies a corresponding entry in the corresponding region.
 6. Themethod of claim 1, wherein prior to the writer restart operation, theentries are accessible to the one or more readers of the shared memorybased on a translation of the pre-restart writer pointers tocorresponding reader pointers.
 7. The method of claim 1, wherein afterthe writer restart operation, the entries are accessible to the one ormore readers of the shared memory based on a translation of the postrestart writer pointers to corresponding reader pointers.
 8. The methodof claim 1, further comprising setting an address pointer type indicatorof a corresponding writer pointer of a corresponding entry to indicatean entry address of the corresponding entry is of a writer pointer typeor a location independent pointer type.
 9. The method of claim 8,wherein the address pointer type indicator of the corresponding entry isset to the writer pointer type causing the one or more readers of theshared memory to locally translate corresponding reader pointers fromthe writer pointer translation table of the shared memory to a readerpointer uniquely identifying the location of a corresponding entry inthe shared memory to the reader at a reader address space.
 10. Themethod of claim 8, wherein the address pointer type indicator of thecorresponding entry is set to the location independent pointer typecausing a reader of the one or more readers of the shared memory tolocally translate a location independent pointer of the correspondingentry, maintained by the reader, to a corresponding reader pointeruniquely identifying the location of the corresponding entry in theshared memory to the reader of the one or more readers of the sharedmemory at a reader address space.
 11. The method of claim 8, whereinsetting the address pointer type indicator is performed simultaneouslywith or after replacing the plurality of pre-restart writer pointers atthe pre-restart writer addressable space with the correspondingplurality of location independent pointers.
 12. The method of claim 8,wherein the address pointer type indicator is maintained as a part of awriter pointer field of the corresponding entry in the shared memory.13. The method of claim 1, wherein the modified pre-restart writerpointers are a truncated version of the plurality of pre-restart writerpointers, respectively, and the modified post-restart writer pointersare a truncated version of the plurality of post-restart writerpointers, respectively.
 14. A method of processing memory address spacescorresponding to a shared memory comprising: accessing an entry in theshared memory, the entry including a corresponding writer pointer with acorresponding address pointer type indicator indicative of a writerpointer type or a location independent pointer type, wherein the entryfurther includes entry data written by a writer of the shared memory; inresponse to the address pointer type indicator indicative of the writerpointer being a writer pointer type, a reader: reading a translationbase pointer from a writer pointer translation table of the sharedmemory, the translation base pointer based on the writer pointer,determining a local reader pointer based on the translation basepointer, the local reader pointer uniquely identifying the location ofthe entry in the shared memory at a reader addressable space employed bythe reader to access the entry in the shared memory; and in response tothe address pointer type indicator indicative of the writer pointerbeing a location independent pointer, the reader: determining the localreader pointer based on the location independent pointer, the locationindependent pointer uniquely identifying the location of the entry inthe shared memory at the reader addressable space employed by the readerto access the entry in the shared memory.
 15. The method of claim 14,wherein the entry is accessed with the location independent pointerafter a writer restart operation and the entry is accessed with thewriter pointer after the location independent pointer is replaced withthe writer pointer.
 16. The method of claim 15, wherein at least aportion of the shared memory is organized into one or more regions andthe location independent pointer is based on, at least in part, a regionidentification uniquely identifying a corresponding region of the entryin the shared memory.
 17. The method of claim 16, wherein an offset ofthe corresponding region distinctly identifies the location of the entrywithin the corresponding region.
 18. The method of claim 14, wherein atleast a portion of the shared memory is organized into one or moreregions and the writer pointer is based on, at least in part, a regionidentification uniquely identifying a corresponding region of the entryin the shared memory.
 19. The method of claim 18, wherein an offset ofthe corresponding region distinctly identifies the location of the entrywithin the corresponding region.
 20. A method of processing memoryaddress spaces corresponding to a shared memory to which a writer agentproduces data and a reader agent consumes the data, the methodcomprising: the writer agent replacing a plurality of pre-restart writerpointers of a pre-restart writer addressable space in the shared memorywith a corresponding plurality of location independent pointers,wherein: the plurality of pre-restart writer pointers uniquelyidentifies locations of entries in the shared memory at the pre-restartwriter addressable space employed by the writer agent to access theentries in the shared memory prior to the writer restart operation, theplurality of pre-restart writer pointers and the plurality of locationindependent pointers including respective address pointer indicatortypes indicative of corresponding writer pointers being a pre-restartwriter pointer or a location independent pointer, and the addresspointer indicator types are written to shared memory at the same time asthe writer pointers; replacing the plurality of location independentpointers with a plurality of post-restart writer pointers in the sharedmemory, respectively, after the writer restart operation, wherein: theplurality of post-restart writer pointers uniquely identify thelocations of the entries in the shared memory at a post-restart writeraddressable space employed by the writer agent to access the entries inthe shared memory after the writer restart operation, and each of theplurality of pre-restart writer pointers includes a correspondingaddress pointer indicator type; in response to determining an addresspointer type indicator is indicative of the writer pointer being alocation independent pointer, the reader agent: determining a localreader pointer based on the location independent pointer; in response todetermining an address pointer type indicator is not indicative of thewriter pointer being a location independent pointer, the reader agent:reading a translation base pointer from a writer pointer translationtable of the shared memory, the translation base pointer based on thewriter pointer, and determining a local reader pointer based on thetranslation base pointer, the local reader pointer uniquely identifyingthe location of the entry in the shared memory at a reader addressablespace employed by the reader agent to access the entry in the sharedmemory before and after the writer restart operation.